@extends('admin.app')

@section('breadcrumb')
    <div class="bg-light lter b-b wrapper-md">
        <ol class="breadcrumb bg-light lter m-n no-padder">
            <li><a href="{{ admin_action('HomeController@index') }}">主页</a></li>
            <li>网站管理</li>
            <li class="active">文章管理</li>
        </ol>
    </div>
@endsection

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      菜单列表
    </div>
    <div class="panel-body">
      <form action="{{ admin_action('System\MenusController@index') }}"  class="form-horizontal">
        <div class="form-group">
          <div class="col-sm-2 control-label">名称或控制器</div>
          <div class="col-sm-2">
            <input type="text" class="form-control" name="search" value="{{ $query['search'] ?? '' }}" placeholder="请输入查询条件">
          </div>
          <div class="col-sm-8 text-right">
            <button class="btn btn-primary" type="submit">查询</button>
            <a class="btn btn-default btn-addon" href="{{ admin_action('System\MenusController@create') }}">
              <i class="fa fa-plus"></i>新增菜单
            </a>
          </div>
        </div>
      </form>
      <div class="table-responsive">
        <table class="table table-striped b-t b-light">
          <thead>
            <tr>
              <th>菜单名称</th>
              <th>控制器</th>
              <th>等级</th>
              <th>图标</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
            @forelse ($list as $row)
            <tr>
              <td>
                <a href="{{admin_action('System\MenusController@show', [$row])}}" data-toggle="tooltip" title="查看菜单信息">{{ $row->name }}</a>
              </td>
              <td>{{ $row->action }}</td>
              <td>{{ $row->level }}</td>
              <td>{!! $row->icon ? "<i class='fa $row->icon'></i>" : '无' !!}</td>
              <td>
                <a class="btn btn-xs btn-primary" href="{{ admin_action('System\MenusController@show', [$row]) }}" data-toggle="tooltip" title="查看该菜单详情">
                  <i class="fa fa-info"></i>
                </a>
                <a class="btn btn-xs btn-primary" href="{{ admin_action('System\MenusController@edit', [$row]) }}" data-toggle="tooltip" title="编辑菜单信息">
                  <i class="fa fa-pencil"></i>
                </a>
                <form class="inline" action="{{ admin_action('System\MenusController@destroy', [$row]) }}" method="post">
                  {{ csrf_field() }}
                  {{ method_field('DELETE') }}
                  <button type="button" data-swal-role="delete-confirm" class="btn btn-xs btn-danger" data-toggle="tooltip" title="删除菜单信息">
                    <i class="fa fa-trash-o"></i>
                  </button>
                </form>
              </td>
            </tr>
            @empty
            <tr>
              <td colspan="5" class="text-center">没有找到菜单记录</td>
            </tr>
            @endforelse
          </tbody>
        </table>
      </div>
      
    </div>
    <div class="panel-footer">
      <div class="row">
        <div class="col-sm-12 text-right text-center-xs">                
          {{ $links }}
        </div>
      </div>
    </div>
  </div>
@endsection